package jiang.app.service;

import java.beans.Transient;
import java.io.File;

import javax.annotation.Resource;

import jiang.app.dao.ICandidateDao;
import jiang.app.entity.Candidate;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

@Component
public class RecommendService {
	@Resource
	ICandidateDao candidateDao;
	
	public boolean saveResume(MultipartFile origin, String savePath) {
		File f = new File(savePath);
		try {
		//	f.createNewFile();
			origin.transferTo(f);
		}
		catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
		return true;
	}

	@Transactional
	public boolean saveCandidate(Candidate c) {
		try{
			candidateDao.insertCandidate(c);
		}
		catch(Exception e){
			e.printStackTrace();
			return false;
		}
		return true;
	}
}
